<%@page import="helpers.StringHelper"%>
<%@page import="helpers.DateHelper"%>
<%@page import="models.SiteConfigModel"%>
<%@page import="models.UserModel"%>
<%@page import="java.util.TreeMap"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
	TreeMap check = (TreeMap) request.getAttribute("check");
	String success = (String) request.getAttribute("success");
	UserModel user = (UserModel) request.getAttribute("user");
	SiteConfigModel siteConfig = (SiteConfigModel) request.getAttribute("config");
	String image = "";//UrlHelper.getServerUrl(request) + "/blobstore-serve?blob-key=" + siteConfig.getLogo();
	String form = (String) request.getAttribute("form");
	
%>
<jsp:include page="/layouts/header.jsp">
	<jsp:param name="language" value="1" />
	<jsp:param name="city" value="ha-noi" />
</jsp:include>
<link rel="stylesheet" type="text/css" href="/css/ui-lightness/jquery-ui-1.8.18.custom.css" />
<script type="text/javascript" src="/js/jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript" src="/js/form-user.js"></script>
<script type="text/javascript">
<!--
$(document).ready(function () {
	loadCity("<%=user.getCity() %>");
	loadDistrict("<%=user.getCity() %>", "<%=user.getDistrict() %>");
	loadWard("<%=user.getDistrict() %>", "<%=user.getWard()%>");
});
//-->
</script>
			<div id="content_inner">
            	<div id="productDetailInfo" class="clearafter">
                	<div class="left">
                		<% if (success != null) { %>
                		<div class="notification-s">
                			<img src="/images/icon_close.gif" />
                			<%=success %>
                		</div>
                		<% } %>
                    	<div id="registerPage">
							<h1>Thông tin cá nhân</h1>
							<p class="mandatoryFields">Thông tin có <span class="redColor">*</span> là bắt buộc nhập, cần phải nhập.</p>                            
                            <form method="post" action="">
                            	<h3>Thông tin tài khoản </h3>
                                <label class="clearafter <%=check.get("username") != null ? "error":""%>">
                                	<span class="left required">Email:</span>
                                    <div class="left">
                                        <input type="text" name="username" value="<%=user.getUsername()%>" <%=form.equalsIgnoreCase("add") ? "" : "disabled=\"disabled\"" %>/>
                                        <div class="triangleUp"></div>
                                        <div class="errorMessage">
                                        	<% if (check.get("username") != null) { %>
												<%=check.get("username")%>
                                        	<% } %>
                                        </div>
                                    </div>
                                </label>
                                <label class="clearafter <%=check.get("password") != null ? "error":""%>">
                                	<span class="left required">Mật khẩu:</span>
                                    <div class="left">
                                        <input type="password" name="password" value="<%=user.getPassword()%>"/>
                                        <div class="triangleUp"></div>
                                        <div class="errorMessage">
                                        	<% if (check.get("password") != null) { %>
												<%=check.get("password")%>
                                        	<% } %>
                                        </div>
                                    </div>
                                </label>
                                <label class="clearafter <%=check.get("repassword") != null ? "error":""%>">
                                	<span class="left required">Nhập lại mật khẩu :</span>
                                    <div class="left">
                                        <input type="password" name="repassword" value="<%=user.getRePassword()%>"/>
                                        <div class="triangleUp"></div>
                                        <div class="errorMessage">
                                        	<% if (check.get("repassword") != null) { %>
												<%=check.get("repassword")%>
                                        	<% } %>
                                        </div>
                                    </div>
                                </label>
                                <h3>Thông tin giao hàng </h3>
                                <label class="clearafter <%=check.get("name") != null ? "error":""%>">
                                	<span class="left required">Họ tên:</span>
                                    <div class="left">
                                        <input type="text" name="name" value="<%=user.getName()%>"/>
                                        <div class="triangleUp"></div>
                                        <div class="errorMessage">
                                        	<% if (check.get("name") != null) { %>
												<%=check.get("name")%>
                                        	<% } %>
                                        </div>  
                                    </div>
                                </label>
                                <label class="clearafter <%=check.get("city") != null ? "error":""%>">
                                	<span class="left">Tỉnh/Thành phố:</span>
                                    <div class="left">
                                        <select name="city">
                                            <option value="">Tỉnh/Thành phố</option>
                                        </select>
                                        <div class="triangleUp"></div>
                                        <div class="errorMessage">
                                        	<% if (check.get("city") != null) { %>
												<%=check.get("city")%>
                                        	<% } %>
                                        </div> 
                                    </div>
                                </label>
                                <label class="clearafter <%=check.get("district") != null ? "error":""%>">
                                	<span class="left">Quận/Huyện: </span>
                                    <div class="left">
                                        <select name="district">
                                            <option value="">Quận/Huyện</option>
                                        </select>
                                        <div class="triangleUp"></div>
                                        <div class="errorMessage">
                                        	<% if (check.get("district") != null) { %>
												<%=check.get("district")%>
                                        	<% } %>
                                        </div> 
                                    </div>
                                </label>
                                <label class="clearafter  <%=check.get("ward") != null ? "error":""%>">
                                	<span class="left">Phường/Xã: </span>
                                    <div class="left">
                                        <select name="ward">
                                            <option value="">Phường/Xã</option>
                                        </select>
                                        <div class="triangleUp"></div>
                                        <div class="errorMessage">
                                        	<% if (check.get("ward") != null) { %>
												<%=check.get("ward")%>
                                        	<% } %>
                                        </div> 
                                    </div>
                                </label>                               
                                <label class="clearafter <%=check.get("address") != null ? "error":""%>">
                                	<span class="left">Số nhà - Ngõ - Ngách:</span>
                                    <div class="left">
                                        <input type="text" name="address" value="<%=user.getAddress()%>"/>
                                        <div class="triangleUp"></div>
                                        <div class="errorMessage">
                                        	<% if (check.get("address") != null) { %>
												<%=check.get("address")%>
                                        	<% } %>
                                        </div>  
                                    </div>
                                </label>
                                <label class="clearafter <%=check.get("street") != null ? "error":""%>">
                                	<span class="left">Đường:</span>
                                    <div class="left">
                                        <input type="text" name="street" value="<%=user.getStreet()%>"/>
                                        <div class="triangleUp"></div>
                                        <div class="errorMessage">
                                        	<% if (check.get("street") != null) { %>
												<%=check.get("street")%>
                                        	<% } %>
                                        </div>  
                                    </div>
                                </label> 
                                <label class="clearafter <%=check.get("phone") != null ? "error":""%>">
                                	<span class="left required">Điện thoại:</span>
                                    <div class="left">
                                        <input type="text" name="phone" value="<%=user.getPhone()%>"/>
                                        <div class="triangleUp"></div>
                                        <div class="errorMessage">
                                        	<% if (check.get("phone") != null) { %>
												<%=check.get("phone")%>
                                        	<% } %>
                                        </div>  
                                    </div>
                                </label> 
                                <label class="clearafter <%=check.get("birthday") != null ? "error":""%>">
                                	<span class="left">Ngày sinh:</span>
                                    <div class="left">
                                        <input type="text" name="birthday" value="<%=DateHelper.dateToString(user.getBirthday(), "yyyy-MM-dd")%>"/>
                                        <div class="triangleUp"></div>
                                        <div class="errorMessage">
                                        	<% if (check.get("birthday") != null) { %>
												<%=check.get("birthday")%>
                                        	<% } %>
                                        </div>  
                                    </div>
                                </label>
                                <label class="clearafter <%=check.get("gender") != null ? "error":""%>">
                                	<span class="left">Giới tính:</span>
                                    <div class="left">
                                        <select name="gender">
                                            <option value="">--</option>
                                            <option value="0" <%=user.getGender() == 0 ? "selected=\"selected\"" : "" %>>Nam</option>
                                            <option value="1" <%=user.getGender() == 1 ? "selected=\"selected\"" : "" %>>Nữ</option>
                                        </select>
                                        <div class="triangleUp"></div>
                                        <div class="errorMessage">
                                        	<% if (check.get("gender") != null) { %>
												<%=check.get("gender")%>
                                        	<% } %>
                                        </div> 
                                    </div>
                                </label> 
                                <div class="registerSubmit">
                                	<button type="submit" class="button blue">Xác nhận</button>
                                </div>
                            </form>                            
                        </div>
                    </div>
                    <div class="right rightSideBar">
                    	<jsp:include page="/elements/right_menu.jsp"/>
                    </div>
                </div>
            </div>

<jsp:include page="/layouts/footer.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>